# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Docs.V1.Model.Link do
  @moduledoc """
  A reference to another portion of a document or an external URL resource.

  ## Attributes

  *   `bookmark` (*type:* `GoogleApi.Docs.V1.Model.BookmarkLink.t`, *default:* `nil`) - A bookmark in this document. In documents containing a single tab, links to bookmarks within the singular tab continue to return Link.bookmarkId when the includeTabsContent parameter is set to `false` or unset. Otherwise, this field is returned.
  *   `bookmarkId` (*type:* `String.t`, *default:* `nil`) - The ID of a bookmark in this document. Legacy field: Instead, set includeTabsContent to `true` and use Link.bookmark for read and write operations. This field is only returned when includeTabsContent is set to `false` in documents containing a single tab and links to a bookmark within the singular tab. Otherwise, Link.bookmark is returned. If this field is used in a write request, the bookmark is considered to be from the tab ID specified in the request. If a tab ID is not specified in the request, it is considered to be from the first tab in the document.
  *   `heading` (*type:* `GoogleApi.Docs.V1.Model.HeadingLink.t`, *default:* `nil`) - A heading in this document. In documents containing a single tab, links to headings within the singular tab continue to return Link.headingId when the includeTabsContent parameter is set to `false` or unset. Otherwise, this field is returned.
  *   `headingId` (*type:* `String.t`, *default:* `nil`) - The ID of a heading in this document. Legacy field: Instead, set includeTabsContent to `true` and use Link.heading for read and write operations. This field is only returned when includeTabsContent is set to `false` in documents containing a single tab and links to a heading within the singular tab. Otherwise, Link.heading is returned. If this field is used in a write request, the heading is considered to be from the tab ID specified in the request. If a tab ID is not specified in the request, it is considered to be from the first tab in the document.
  *   `tabId` (*type:* `String.t`, *default:* `nil`) - The ID of a tab in this document.
  *   `url` (*type:* `String.t`, *default:* `nil`) - An external URL.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :bookmark => GoogleApi.Docs.V1.Model.BookmarkLink.t() | nil,
          :bookmarkId => String.t() | nil,
          :heading => GoogleApi.Docs.V1.Model.HeadingLink.t() | nil,
          :headingId => String.t() | nil,
          :tabId => String.t() | nil,
          :url => String.t() | nil
        }

  field(:bookmark, as: GoogleApi.Docs.V1.Model.BookmarkLink)
  field(:bookmarkId)
  field(:heading, as: GoogleApi.Docs.V1.Model.HeadingLink)
  field(:headingId)
  field(:tabId)
  field(:url)
end

defimpl Poison.Decoder, for: GoogleApi.Docs.V1.Model.Link do
  def decode(value, options) do
    GoogleApi.Docs.V1.Model.Link.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Docs.V1.Model.Link do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
